<template>
	<view class="container">
		<view class="up">
			<!-- 标题 -->
			<!-- <view class="title">账户余额</view> -->
			<!-- 余额展示 -->
			<view class="balance">
				<text class="currency">¥</text>
				<text class="amount">{{ driver.getCurrentDriver().accountBalance.toFixed(1) }}</text>
			</view>
			<!-- 余额明细入口 -->
			<view class="detail" @tap="gotoNextPage('balance-list')">
				<text>余额明细</text>
				<uni-icons type="right" color="#666"></uni-icons>
			</view>
			<!-- 充值记录入口 -->
			<view class="detail" @tap="gotoNextPage('recharge-list')">
				<text>充值记录</text>
				<uni-icons type="right" color="#666"></uni-icons>
			</view>
			<!-- 提现记录入口 -->
			<view class="detail" @tap="gotoNextPage('withdraw-list')">
				<text>提现记录</text>
				<uni-icons type="right" color="#666"></uni-icons>
			</view>
		</view>
		
		<view class="down">
			<!-- 充值按钮 -->
			<view class="btn recharge-btn" @tap="gotoNextPage('recharge')">充值</view>
			<!-- 提现按钮 -->
			<view class="btn withdrawal-btn" @tap="gotoNextPage('withdraw')">免费提现</view>
		</view>
		
	</view>
</template>

<script setup>
import { ref } from 'vue'
import { useUserStore } from '@/stores/userStore.js'

const driver = useUserStore()

function gotoNextPage (url) {
	uni.navigateTo({
		url: `/pages/mine/${url}`
	})
}
</script>

<style lang="scss" scoped>
view {
	box-sizing: border-box;
}

.container {
	width: 100vw;
	height: 100vh;
	padding: 200rpx 0;
	background-color: #f8f8f8;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: space-between;
	
	.up {
		display: flex;
		flex-direction: column;
		align-items: center;
		.title {
			font-size: 36rpx;
			margin-bottom: 20rpx;
		}
		
		.balance {
			font-weight: 600;
			margin-bottom: 30rpx;
			.currency {
				font-size: 42rpx;
			}
			.amount {
				font-size: 80rpx;
			}
		}
		
		.detail {
			margin-bottom: 30rpx;
			font-size: 28rpx;
			color: #666;
			display: flex;
			align-items: center;
		}
	}
	
	.down {
		.btn {
			width: 400rpx;
			height: 88rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			border-radius: 8rpx;
			font-size: 32rpx;
			transition: all 0.2s ease;
		}
		.recharge-btn {
			background-color: #d9001b;
			color: #fff;
			margin-bottom: 20rpx;
			&:active {
				background-color: #c8001a;
			}
		}
		.withdrawal-btn {
			background-color: #f8f8f8;
			color: #333;
			border: 2rpx solid #ccc;
			&:active {
				background-color: #eee;
			}
		}
	}
	
}
</style>